# -*- coding: utf-8 -*-
# __author__ = 'xxx'
# env: python 2.7  bottle 0.12.23
# fuction: 在模板中显示列表数据

import bottle

from bottle import  route,run,template

showlisttmp='''
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>

<body>
<h3>显示列表</h3>
% for i in showlist:
    <h1> {{i}} </h1>
% end

<p>定义在单个文件中</p>

</body>

</html>

'''

@route('/showall')
def show():
    '''显示列表'''


    showlist=(1,2,3,4,5,6,7)

    return template(showlisttmp,showlist=showlist)
    #引用模板文件
    #return template("showlisttmp",showlist=showlist)





if __name__ == '__main__':
    run(host='0.0.0.0',port=8080,reloader=True,debug=True)

else:
    bottle.default_app()



